package v1

import (
	"myapp/internal/model/entity"

	"github.com/gogf/gf/v2/frame/g"
)

// 角色的权限列表
type GetListReq struct {
	g.Meta `path:"/access/get_list" method:"post" sm:"查询角色" tags:"权限"`
	RoleId uint `json:"role_id"  v:"integer|min:1"  dc:"角色ID"  `
}

type GetListRes struct {
	Lst []*entity.Access
}

// 为角色创建权限
type CreateReq struct {
	g.Meta    `path:"/access/create" method:"post" sm:"分配角色权限" tags:"权限"`
	RoleId    uint `json:"role_id"    v:"integer|min:1" dc:"角色id" `
	MenuId    uint `json:"menu_id"    v:"integer|min:1" dc:"menu.id" `
	MenuLevel uint `json:"menu_level" v:"integer|min:1" dc:"menu.层级" `
	MenuPid   uint `json:"menu_pid"   v:"integer|min:0" dc:"menu.父级" `
}

type CreateRes struct {
	Id int64 `json:"id"   `
}

// 为角色创建权限
type CreateBatchReq struct {
	g.Meta  `path:"/access/create_batch" method:"post" sm:"批量分配角色权限" tags:"权限"`
	RoleId  uint   `json:"role_id"    v:"integer|min:1" dc:"角色id" `
	MenuIds []uint `json:"menu_ids"    v:"required" dc:"menu.id" `
}

type CreateBatchRes struct {
}

// 用户的权限
type MemberMenuReq struct {
	g.Meta `path:"/access/member_menus" method:"post" sm:"用户的菜单权限" tags:"帐户"`
}

type MemberMenuRes struct {
	Menus []*entity.AdminMenu
}
